package com.adv.ems.controller.remote;

import com.adv.ems.model.dto.APIRequest;
import com.adv.ems.model.dto.APIResponse;
import com.adv.ems.model.param.RemotePointAutoCreateParam;
import com.adv.ems.model.param.RemoteUploadDataParam;
import com.adv.ems.service.RemoteService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

@RestController
@RequestMapping("/ems/remote")
public class RemoteController {
    @Resource
    RemoteService remoteService;

    @PostMapping("/point/auto/create")
    public APIResponse<Long> pointAutoCreate(@RequestBody APIRequest<RemotePointAutoCreateParam> request) {
        return APIResponse.<Long>build().content(remoteService.pointAutoCreate(request.getContent()));
    }

    @PostMapping("/upload/data")
    public APIResponse<Integer> uploadData(@RequestBody APIRequest<RemoteUploadDataParam> request) {
        return APIResponse.<Integer>build().content(remoteService.uploadData(request.getContent()));
    }
}
